#include <cstdio>
int main()
{//将该问题转化为进制问题
    int due,money,change;
    int G,S,K;
    scanf("%d.%d.%d",&G,&S,&K);
    due=K+S*29+G*17*29;//先把价钱全部转化为Knut
    scanf("%d.%d.%d",&G,&S,&K);
    money=K+S*29+G*17*29;
    change=money-due;
    if(change>=0)
    {
        printf("%d.%d.%d\n",(change/29)/17,(change/29)%17,change%29);
    }else{
        change=-change;
        printf("-%d.%d.%d\n",(change/29)/17,(change/29)%17,change%29);
    }
}